package si.unimb.src.wifisms.communicator.types;

import java.util.*;
import org.ksoap2.serialization.*;

/**
 * 
 * @author Ales
 * 
 * Razred, ki se uporablja pri klicih webservica - taksna je namrec struktura v WSDL.
 *
 */
public class ArrayOfString implements KvmSerializable {

	private ArrayList<String> array = new ArrayList<String>();
	
	public void addString(String s) {
	
		array.add(s);
		
	}
	
	public ArrayOfString() {}
	
	public ArrayOfString(ArrayList<String> array) {
		
		this.array = array;
		
	}
	
	/*
	 * 
	 * Implementacija vmesnika KvmSerializable
	 * 
	 */
	
	@Override
	public Object getProperty(int index) {
		
		if(array.isEmpty()) return null;
		
		return array.get(index);
		
	}

	@Override
	public int getPropertyCount() {

		return array.size();
		
	}

	@Override
	public void getPropertyInfo(int index, @SuppressWarnings("rawtypes") Hashtable arg1, PropertyInfo info) {

		info.type = PropertyInfo.STRING_CLASS;
        info.name = "string";

	}

	@Override
	public void setProperty(int index, Object value) {

		String stringValue = (String)value;
		array.set(index, stringValue);

	}

}
